
<h1><?= $this->translate('#Module') ?></h1>
<?
    $currentType = 0;
    $currentTypeName = "";

    $var_tree->apply(
        function($cat) use (&$currentType, &$currentTypeName) {
            $prefix = $cat->parentId > 0 ? ' &ndash; ' : ' + ';
            $onclick = "";
            if (0 == $cat->parentId) {

                // close previous container div
                if ($currentType > 0) {
                    print <<<html
                </div>\n
html;
                }
                $currentType = $cat->id;
                $currentTypeName = '';
                $onclick = " onclick=\"$('#dc-type-{$currentType}').toggle();return false\"";
            }
            print <<<html
                    <b>{$prefix}</b>
                    <a href="/catalog/{$currentTypeName}{$cat->name}"{$onclick}>{$cat->title}</a><br/>\n
html;
            if (0 == $cat->parentId) {
                $currentType = $cat->id;
                $currentTypeName = $cat->name . '/';

                // open a container div
                print <<<html
                <div id="dc-type-{$currentType}" style="display: none">\n
html;
            }
        }
    ) ;

    if ($currentType > 0) {
        print <<<html
                </div>\n
html;
    }
?>
<?= $this->renderTemplate($this->createTemplate('actionsMenu')) ?>